#pragma once

#include "MapLayer.h"
#include "ogr_api.h"
#include "proj_api.h"
#include "Tool.h"

class CMap2ClientTransform
{
public:
    CMap2ClientTransform(void);
    ~CMap2ClientTransform(void);
    void setParameters(CSize* clientSize,CMapLayerEnvelope* mapExtend);
    void transform2Client(double &x, double &y);
	void transform2Map(double &x, double &y,double& mapX,double& mapY);
	void setSourceCRS(OGRSpatialReferenceH sourceCRS);
	void setDestCRS(OGRSpatialReferenceH destCRS);
	void offset(CMousePoint offset);
	void zoomAtPoint(CMousePoint point, double ratio);
private:
    double mPixelsPerMapUnit;
	CMapLayerEnvelope m_curEnvelope;
	CSize m_clientSize;
	OGRSpatialReferenceH m_sourceCRS;
	OGRSpatialReferenceH m_destCRS;
	projPJ m_destProjection;
	projPJ m_sourProjection;
	TCHAR* m_sourProj4;
	TCHAR* m_destProj4;
	CMousePoint m_preClientPoint;
	CPointGeometry m_preMapPoint;
};
